<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class UserProjectOrder extends Model
{
    protected  $table='user_project_order';

    protected $fillable = [
        'user_id',
        'project_id',
        'user_project_id',
        'org_id',
        'amount',
        'goods_info',
        'status',
        'pay_time',
        'cash_time',
        'cast_apply_id',
        'user_trans_id',
    ];

    protected  $casts = [
        'goods_info'=>'array'
    ];

    public function userProject() {
        return $this->belongsTo('App\Models\UserProject', 'user_project_id', 'id');
    }

    public function project() {
        return $this->belongsTo('App\Models\Project', 'project_id', 'id');
    }


    public function user() {
        return $this->belongsTo('App\User', 'user_id', 'id');
    }

    public function volunteer() {
        return $this->belongsTo('App\Models\Volunteer', 'user_id', 'user_id');
    }

    public function org() {
        return $this->belongsTo('App\Models\Org', 'org_id', 'id');
    }

}
